package com.lyj.cloud.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.oauth2.client.OAuth2ClientContext;
import org.springframework.security.oauth2.client.resource.OAuth2ProtectedResourceDetails;

import feign.RequestInterceptor;

/**
 * 将这个配置添加到FeignClient上
 * @author sunshine
 *
 */
@Configuration
public class OAuth2FeignAutoConfiguration {
	
	@Bean
	public RequestInterceptor oauth2FeignRequestInterceptor(OAuth2ProtectedResourceDetails resource, OAuth2ClientContext context){
	    return new org.springframework.cloud.security.oauth2.client.feign.OAuth2FeignRequestInterceptor(context, resource);
	}
}
